﻿using System;

class CalculateSumOfFactorials

            // Write a program that, for a given two integer numbers N and X, calculates the sumS = 1 + 1!/X + 2!/X2 + … + N!/XN

{
    static void Main()
    {
        Console.WriteLine("Enter value for 'N' and 'X':");
        double n = double.Parse(Console.ReadLine());
        double x = double.Parse(Console.ReadLine());
        double sum = 1;
        double factorial = 1;
        for (double i = 1; i <= n; i++)
        {
            for (double j = 1; j <= i; j++)
            {
                factorial *= j;
            }
            sum += factorial / Math.Pow(x, i);
            factorial = 1;
        }
        Console.WriteLine("The sum of the equation is {0}", sum);
    }
}

